package com.example.a2209_shop.database

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.base.entity.UserEntity

@Dao
interface UserDao {
    //新增
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUser(user:UserEntity)

    //修改
    @Update
    fun updateUser(user:UserEntity)
    //删除单个
    @Delete
    fun deleteUser(user:UserEntity)
    //删除所有
    @Query("delete from user_info")
    fun deleteAll()
    //带条件查询
    @Query("select * from user_info where id = :id")
    fun queryBy(id:Int):UserEntity?//根据实际情况调整返回值
}